package com.dong.aoptools.constant;

import com.dong.aoptools.premain.handler.AOPHandler;
import com.dong.aoptools.premain.handler.CommonHandler;
import com.dong.aoptools.premain.handler.OutputLoadedClassHandler;
import com.dong.aoptools.view.handlerview.AOPHandlerView;
import com.dong.aoptools.view.handlerview.CommonHandlerView;
import com.dong.aoptools.view.handlerview.OutputLoadedClassHandlerView;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @description:
 * @author: 陈瑞东
 * @create: 2021-11-16 17:00
 */
public class PropertiesConst {
    public static final String CONFIG_DIR = "config"; // 配置文件名
    public static final String CONFIG_PROPERTIES = "config.properties"; // 配置文件名
    public static final String CONFIG_FIELD_HANDLER_ACTIVE = "handler-active"; // 配置选中处理对象

    public static final String TYPE_AOP = "AOPHandler"; // AOP类型
    public static final String TYPE_OUTPUT_LOADED_CLASS = "OutputLoadedClassHandler"; // 输出类文件类型
    // 配置说明映射
    public static final Map<String, String> HANDLER_DESC_KEY_VALUE = new LinkedHashMap<String, String>() {{
        put(TYPE_AOP, "AOP工具");
        put(TYPE_OUTPUT_LOADED_CLASS, "保存加载的.class文件");
    }};
    // 配置类映射
    public static final Map<String, CommonHandler> HANDLER_KEY_VALUE = new LinkedHashMap<String, CommonHandler>() {{
        put(TYPE_AOP, new AOPHandler());
        put(TYPE_OUTPUT_LOADED_CLASS, new OutputLoadedClassHandler());
    }};
    // 配置视图映射
    public static final Map<String, CommonHandlerView> HANDLER_VIEW_KEY_VALUE = new LinkedHashMap<String, CommonHandlerView>() {{
        put(TYPE_AOP, new AOPHandlerView());
        put(TYPE_OUTPUT_LOADED_CLASS, new OutputLoadedClassHandlerView());
    }};

    /* ======================= AOPHandler相关常量 开始 ======================= */
    public static final String CONFIG_FIELD_PACKAG_SCAN = "package-scan"; // 扫描包
    public static final String CONFIG_FIELD_PACKAGE = "package"; // 代理类的包
    public static final String CONFIG_FIELD_CLASS = "class"; // 代理类名
    public static final String CONFIG_FIELD_ANNO = "anno"; // 代理注解
    public static final String CONFIG_FIELD_BEFORE = "before"; // before方法名
    public static final String CONFIG_FIELD_AFTER = "after"; // after方法名
    // 配置文件字段说明
    public static final Map<String, String> CONFIG_KEY_DESC = new LinkedHashMap<String, String>() {{
        put(CONFIG_FIELD_PACKAG_SCAN, "扫描包");
        put(CONFIG_FIELD_PACKAGE, "代理类的包");
        put(CONFIG_FIELD_CLASS, "代理类名");
        put(CONFIG_FIELD_ANNO, "代理注解");
        put(CONFIG_FIELD_BEFORE, "before方法名");
        put(CONFIG_FIELD_AFTER, "after方法名");
    }};
    /* ======================= AOPHandler相关常量 结束 ======================= */

    /* ======================= OutputLoadedClassHandler相关常量 开始 ======================= */

    public static final String CONFIG_FIELD_OUTPUT_PRINT_CLASS = "output.print-class"; // 要打印的类名
    public static final String CONFIG_FIELD_OUTPUT_PATH = "output.path"; // 存储路径

    // 配置文件字段说明
    public static final Map<String, String> CONFIG_OUTPUT_KEY_DESC = new LinkedHashMap<String, String>() {{
            put(CONFIG_FIELD_OUTPUT_PRINT_CLASS, "要保存的类名");
            put(CONFIG_FIELD_OUTPUT_PATH, "存储路径");
    }};
    /* ======================= OutputLoadedClassHandler相关常量 开始 ======================= */

}
